#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
	int StrToInt(string str) {
		long long lld = 0;
		int flag = 1;
		string::iterator it = str.begin();
		if (*it == '-')
		{
			flag = -1;
			it++;
		}
		else if (*it == '+')
			it++;
		while (it != str.end()) {
			if (*it >= '0' && *it <= '9')
			{
				lld += (*it - '0');
			}
			else {
				return 0;
			}
			it++;
			if (it == str.end())
				break;;
			lld *= 10;
		}
		//lld/=10;
		lld *= flag;
		return lld;
	}
};